export const showNav = function ({ dispatch, state }) {
  dispatch('SHOWNAV', !state.navShow)
}
export const addRoom = function ({ dispatch }, room) {
  dispatch('ADDROOM', room)
}
export const removeRoom = function ({ dispatch }) {
  dispatch('REMOVEROOM')
  dispatch('SHOWDELROOMCONFIRM', false, -1, '0')
}
export const cancelDelConfrim = function ({ dispatch }) {
  dispatch('SHOWDELROOMCONFIRM', false, -1, '0')
}
export const showDelRoomConfirm = function ({ dispatch }, index, roomId) {
  dispatch('SHOWDELROOMCONFIRM', true, index, roomId)
}
export const showMsg = function ({ dispatch, state }, roomId) {
  if (!roomId) {
    dispatch('RIGHTDRAWERCLOSE')
    return
  }
  dispatch('SHOWMSG', roomId)
  dispatch('INITMSGS')
}
export const showRank = function ({ dispatch, state }, roomId) {
  if (!roomId) {
    dispatch('RIGHTDRAWERCLOSE')
    return
  }
  dispatch('SHOWRANK', roomId)
  if (state.rightDrawer.showRank) {
    dispatch('INITGIFT', roomId.indexOf('dy') > -1 ? 'dy' : 'panda')
    dispatch('GETRANK', 'msgs')
  }
}
export const closeRightDrawer = function ({ dispatch }) {
  dispatch('RIGHTDRAWERCLOSE')
}
export const bindMsgEl = function ({ dispatch }, el) {
  dispatch('BINDMSGS', el)
}
export const getRank = function ({ dispatch }, field) {
  dispatch('GETRANK', field)
}
